package com.example.suanfademo;

import java.util.Arrays;

public class Movezeo {

        public int[] moveZeroes(int[] nums) {
            int slow =0;
            for(int fast = 0; fast<nums.length; fast++){
                if(nums[fast]!=0){
                    nums[slow]=nums[fast];
                    slow++;
                }
            }
            for(int i=slow; i<nums.length;i++){
                nums[i]=0;
            }
            return nums;
        }

    public static void main(String[] args) {
        Movezeo movezeo = new Movezeo();
        int[] ints = movezeo.moveZeroes(new int[]{0, 1, 0, 3, 12});
        System.out.println(Arrays.toString(ints));
    }
}
